using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_fieldnamesMap : EntityTypeConfiguration<so_fieldnames>
    {
        public so_fieldnamesMap()
        {
            // Primary Key
            this.HasKey(t => new { t.field, t.title });

            // Properties
            this.Property(t => t.field)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.title)
                .IsRequired()
                .HasMaxLength(39);

            // Table & Column Mappings
            this.ToTable("so_fieldnames");
            this.Property(t => t.field).HasColumnName("field");
            this.Property(t => t.title).HasColumnName("title");
        }
    }
}
